package crivia.eca.am2.carry;

import java.util.List;

import crivia.c.a.KeyLink;
import crivia.c.carry.RelationKey;
import crivia.c.carry.ValueField;
import crivia.c.exception.CarryIOFail;
import crivia.ecp.a.ECC;
import crivia.ecp.carry.ec.workflow.WFBase;
import crivia.src.CI;

public class WorkflowModel extends ECC {
	
	static {
		
		if (! createTable(WorkflowModel.class, true)){
			throw new CarryIOFail("Data Base Table Create Fail.");
		}
		
	}
	
	public static void main(String[] args) {
		CI.refreshDBI(WorkflowModel.class);
		CI.refreshFields(WorkflowModel.class);
	}

	@Override
	public String tableName() {
		return "Crivia_AM2_WM";
	}

	@Override
	public void keyLinks(List<KeyLink> keyLinks) {
		keyLinks.add(ValueField.c2d("workflowID"));
		keyLinks.add(RelationKey.c2d("workflowName", "workflowID"
				, WFBase.table(), WFBase.pk()));
	}


	
	//XXX DBI Begin.
	public enum Keys{
		workflowID("workflowID","workflowID")
		,workflowName("workflowName","workflowName")
		;
		private String _dbKey;
		private String _key;
		Keys(String key,String dbKey){_key=key;_dbKey=dbKey;}
		@Override
		public String toString(){return _dbKey;}
		/**  <b>Key</b> in <b>Carry</b>. */
		public String key(){return _key;}
	}
	private static crivia.eca.am2.carry.WorkflowModel dbi;
	public synchronized static void initDBI(){if(null!=dbi)return;dbi=new crivia.eca.am2.carry.WorkflowModel();}
	/**  <b>DB Table</b> of <b>Carry</b>. */
	public static String table(){initDBI();return dbi.tableName();}
	/**  <b>Primary Key</b> of <b>Carry</b>. */
	public static String pk(){initDBI();return dbi.pk4db();}
	/**  <b>Relation SQL</b> of <b>Relation Key</b>. */
	public static String rSQL(crivia.eca.am2.carry.WorkflowModel.Keys k,String t){initDBI();return dbi.relationSQL(k.key(),t);}
	//XXX DBI End.



	

	// XXX Fields Begin.



	/** ...(Miss Tip Text.) */
	private java.lang.String id;
	/** Getter for ...(Miss Tip Text.) */
	public java.lang.String getId(){
		return id;
	}
	/** Setter for ...(Miss Tip Text.) */
	public crivia.eca.am2.carry.WorkflowModel setId(java.lang.String id){
		this.id = id;
		return this;
	}


	/** ...(Miss Tip Text.) */
	private java.lang.String workflowID;
	/** Getter for ...(Miss Tip Text.) */
	public java.lang.String getWorkflowID(){
		return workflowID;
	}
	/** Setter for ...(Miss Tip Text.) */
	public crivia.eca.am2.carry.WorkflowModel setWorkflowID(java.lang.String workflowID){
		this.workflowID = workflowID;
		return this;
	}


	/** ...(Miss Tip Text.) */
	private java.lang.String workflowName;
	/** Getter for ...(Miss Tip Text.) */
	public java.lang.String getWorkflowName(){
		return workflowName;
	}
	/** Setter for ...(Miss Tip Text.) */
	public crivia.eca.am2.carry.WorkflowModel setWorkflowName(java.lang.String workflowName){
		this.workflowName = workflowName;
		return this;
	}


	// XXX Fields End.

}